package com.lz.hotel_java.service;

import com.lz.hotel_java.entity.Room;
import com.lz.hotel_java.mapper.RoomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomServiceImpl implements RoomService {
    @Autowired
    private RoomMapper roomMapper;

    @Override
    public List<Room> getAllRooms() {
        return roomMapper.selectAll();
    }

    @Override
    public boolean addRoom(Room room) {
        return roomMapper.insert(room) > 0;
    }

    @Override
    public boolean updateRoom(Room room) {
        return roomMapper.update(room) > 0;
    }

    @Override
    public boolean deleteRoom(Integer roomId) {
        return roomMapper.deleteById(roomId) > 0;
    }
}
